package com.ruoyi.patrol.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.patrol.mapper.PtDeviceMapper;
import com.ruoyi.patrol.domain.PtDevice;
import com.ruoyi.patrol.service.IPtDeviceService;

/**
 * 设备Service业务层处理
 * 
 * @author lkm
 * @date 2024-12-05
 */
@Service
public class PtDeviceServiceImpl implements IPtDeviceService 
{
    @Autowired
    private PtDeviceMapper ptDeviceMapper;

    /**
     * 查询设备
     * 
     * @param deviceId 设备ID
     * @return 设备
     */
    @Override
    public PtDevice selectPtDeviceById(Long deviceId)
    {
        return ptDeviceMapper.selectPtDeviceById(deviceId);
    }

    /**
     * 查询设备列表
     * 
     * @param ptDevice 设备
     * @return 设备
     */
    @Override
    public List<PtDevice> selectPtDeviceList(PtDevice ptDevice)
    {
        return ptDeviceMapper.selectPtDeviceList(ptDevice);
    }

    /**
     * 新增设备
     * 
     * @param ptDevice 设备
     * @return 结果
     */
    @Override
    public int insertPtDevice(PtDevice ptDevice)
    {
        ptDevice.setCreateTime(DateUtils.getNowDate());
        return ptDeviceMapper.insertPtDevice(ptDevice);
    }

    /**
     * 修改设备
     * 
     * @param ptDevice 设备
     * @return 结果
     */
    @Override
    public int updatePtDevice(PtDevice ptDevice)
    {
        ptDevice.setUpdateTime(DateUtils.getNowDate());
        return ptDeviceMapper.updatePtDevice(ptDevice);
    }

    /**
     * 批量删除设备
     * 
     * @param deviceIds 需要删除的设备ID
     * @return 结果
     */
    @Override
    public int deletePtDeviceByIds(Long[] deviceIds)
    {
        return ptDeviceMapper.deletePtDeviceByIds(deviceIds);
    }

    /**
     * 删除设备信息
     * 
     * @param deviceId 设备ID
     * @return 结果
     */
    @Override
    public int deletePtDeviceById(Long deviceId)
    {
        return ptDeviceMapper.deletePtDeviceById(deviceId);
    }
}
